﻿using Architecture.Domain.Service;
using Architeture.Domain;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler
{
    public class PicCreateCommandHandler : IRequestHandler<PicCreateCommand, int>
    {
        protected readonly IAllPicService allPicService;

        public PicCreateCommandHandler(IAllPicService allPicService)
        {
            this.allPicService = allPicService;
        }

        public async Task<int> Handle(PicCreateCommand request, CancellationToken cancellationToken)
        {
            return await allPicService.AddPic(new AllPic() { APic = request.APic, PicType = request.PicType, GoodsInfoid = request.GoodsInfoid });
        }
    }
}
